﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraReports.UI;
using DevExpress.XtraCharts;
using System.Data;
using System.Drawing;

namespace ZX.Report
{
    /// <summary>
    /// 报表类型
    /// </summary>
    public enum ReportType
    {
        List,//列表报表
        Chart,//图形报表
    }

    /// <summary>
    /// 报表基类
    /// </summary>
    public abstract class ReportFactory
    {
        /// <summary>
        /// 报表参数基类
        /// </summary>
        public ParamsFactory paramsFactory { get; set; }
        /// <summary>
        /// 获取报表
        /// </summary>
        /// <returns></returns>
        public abstract XtraReport GetReport();

        /// <summary>
        /// 报表基类实例化
        /// </summary>
        /// <param name="paramsFactory"></param>
        /// <returns></returns>
        public static ReportFactory GetInstance(ParamsFactory paramsFactory)
        {
            ReportFactory reportFactory = null;
            try
            {
                if (paramsFactory.reportType == ReportType.List)
                {
                    reportFactory =ListReport.GetInstance(paramsFactory);
                }
                else if (paramsFactory.reportType == ReportType.Chart)
                {
                    reportFactory = ChartReport.GetInstance(paramsFactory);
                }
            }
            catch 
            { }
            return reportFactory;
        }
    }
}
